{{if $CurrentUser['id']}}

		<div class="ui-portlet">
			<ol class="breadcrumb">
			  <li><a href="/users/index"><i class="fa fa-home"></i>&nbsp;&nbsp;{{__('Personal Center')}}</a></li>
			  <li class="active">我的团队</li>
			</ol>
		</div>        
       <hr>
       	<?php $team_id =  $Team['Team']['id'];?>
			<div class="detail btline2 ">
				{{if $Team['Team']['coverimg']}}{{$this->Html->image($Team['Team']['coverimg'])}}{{/if}}
				<p>{{$Team['Team']['name']}}</p>				
				<p>{{$Team['Team']['created']}}</p>
				
				<portlet title="{{__('团队成员')}}" fields="TeamMember.*,User.*"  limit="20" cache="no" model="User" list_tpl="inner" info="joins[0][table]=team_members&joins[0][alias]=TeamMember&joins[0][type]=inner&joins[0][conditions][]=TeamMember.user_id=User.id&&joins[0][conditions][TeamMember.team_id]=$team_id">
					{{if $item_all['TeamMember']['status']==1}}
					<li><label class="label label-success">{{$item['username']}}</label>  {{$item['email']}} &nbsp; {{$item_all['TeamMember']['created']}}</li>
					{{else}}
					<li><label class="label label-default">{{$item['username']}}</label>  {{$item['email']}} &nbsp; {{$item_all['TeamMember']['created']}}</li>
					{{/if}}
				</portlet>
				
				<portlet title="{{__('团队成员邀请记录')}}" cache="no" model="TeamInvite" limit="20" list_tpl="inner" info="conditions[team_id]=$team_id">
					{{if $item['status']==1}}
						<li><label class="label label-success">{{$item['email']}}</label> {{$item['created']}} </li>
					{{else}}
						<li>
							<label class="label label-default">{{$item['email']}}</label> {{$item['created']}} 
							<!-- <a class="btn btn-sm btn-default" href="{{$this->Html->url('/team_invites/invite')}}?email={{$item['email']}}&team_id={{$model_item['id']}}">{{__('Resend Email')}}</a>  -->
							<a class="btn btn-sm btn-default" href="{{$this->Html->url('/team_invites/delete/'.$item['id'])}}">{{__('取消邀请')}}</a> 
						</li>
					{{/if}}
				</portlet>
				
				<portlet title="邀请用户加入团队">
				{{$this->MForm->create('Team',array('controller'=>'teams','action'=>'invite_member'))}}
					{{$this->MForm->input('email',array('type'=>'email','label'=>'注册邮箱','div'=>'form-inline'))}}
					
					{{$this->MForm->hidden('team_id',array('value'=> $Team['Team']['id']))}}
					
					<div class="row">
						<label class="col-sm-2 control-label"></label>
						<div class="col-sm-10 controls"><input class="btn btn-primary" type="submit" value="{{__('Submit')}}"></div>
					</div>
					
				{{$this->MForm->end()}}
				</portlet>
				
				<div class="alert alert-warning">提示：邀请后系统会给邮箱用户发送站内消息，请提醒您的小伙伴查看站内消息。</div>
			</div>
{{else}}
<div class="container">
 	<div class=" ui-portlet" id="Team-mine-list">	您还没有登录，请<a href="/users/login" onclick="return checkLogin();">登录</a>后查看。</div>
</div>
{{/if}}
    	
